﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace Slock.GameObjects.ActorComponents
{
    /// <summary>
    /// Base class for collision components for actors
    /// </summary>
    public abstract class CollisionComponent : ActorComponent
    {
        /// <summary>
        /// Initializes a new instance of CollisionComponent
        /// </summary>
        /// <param name="owner"></param>
        public CollisionComponent(ref Actor owner) : base(ref owner)
        { }

        /// <summary>
        /// If this component is intersecting with a collision primitive
        /// </summary>
        /// <param name="box">The primitive to check against</param>
        /// <returns>True if any kind of intersection is occuring, false if the primitives are disjoint</returns>
        public abstract bool Intersecting(BoundingBox box);

        /// <summary>
        /// If this component is intersecting with a camera frustum
        /// </summary>
        /// <param name="box">The primitive to check against</param>
        /// <returns>True if any kind of intersection is occuring, false if the primitives are disjoint</returns>
        public abstract bool Intersecting(BoundingFrustum frustum);

        /// <summary>
        /// If this component is intersecting with a collision primitive
        /// </summary>
        /// <param name="box">The primitive to check against</param>
        /// <returns>True if any kind of intersection is occuring, false if the primitives are disjoint</returns>
        public abstract bool Intersecting(BoundingSphere sphere);

        /// <summary>
        /// If this component is intersecting with a planar surface
        /// </summary>
        /// <param name="box">The primitive to check against</param>
        /// <returns>True if any kind of intersection is occuring, false if the primitives are disjoint</returns>
        public abstract bool Intersecting(Plane plane);

        /// <summary>
        /// If this component is in the path of a ray cast
        /// </summary>
        /// <param name="box">The primitive to check against</param>
        /// <returns>True if any kind of intersection is occuring, false if the primitives are disjoint</returns>
        public abstract bool Intersecting(Ray ray);

        /// <summary>
        /// Gets the type of intersection occuring between to collision primitives
        /// </summary>
        /// <param name="box">Collision primitive</param>
        /// <returns>Type of intersection</returns>
        public abstract ContainmentType Contains(BoundingBox box);

        /// <summary>
        /// Gets the type of intersection occuring between to collision primitives
        /// </summary>
        /// <param name="ray">Collision primitive</param>
        /// <returns>Type of intersection</returns>
        public abstract ContainmentType Contains(Ray ray);

        /// <summary>
        /// Gets the type of intersection occuring between to collision primitives
        /// </summary>
        /// <param name="sphere">Collision primitive</param>
        /// <returns>Type of intersection</returns>
        public abstract ContainmentType Contains(BoundingSphere sphere);

        /// <summary>
        /// Gets the type of intersection occuring between to collision primitives
        /// </summary>
        /// <param name="plane">Collision primitive</param>
        /// <returns>Type of intersection</returns>
        public abstract PlaneIntersectionType Contains(Plane plane);

        /// <summary>
        /// Updates the collision primitve
        /// </summary>
        public abstract void UpdatePrimitive();
    }
}
